import os
from scheduler_package.logger import scheduler_logger as log
from scheduler_package.models import delete_run_history
from user.models import UserModel

#推送到数据仓的告警信息：5分钟执行一次
def send_to_big_data(a,b):
    log.info(f'推送到大数据仓,{a}+{b}={a+b}')

#清除定时任务历史运行记录
def delete_apscheduler_history():
    #清除历史运行记录
    delete_run_history()

def crontab_task():
    log.info('crontab定时器')

def date_task():
    log.info('date定时器')

def func(a=10,b=12):
    log.info(f'func: {a}+{b}={a+b}')

def add_user(data_dict):
    try:
        log.info(f"执行定时任务前，{data_dict}")
        UserModel.objects.create(**data_dict)
        log.info(f"执行定时任务成功，{data_dict}")
    except Exception as e:
        log.exception(f'创建用户信息失败了，{e}')

if __name__ == '__main__':
    print(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))